package com.bawei.demo_mvvm.repository

import com.bawei.demo_mvvm.http.MyService
import com.bawei.demo_mvvm.http.RetrofitManager
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn
import javax.inject.Inject

/**
 * @author yaotianxue
 * @description
 * @date 2025/5/12
 */
class VideoRepository @Inject constructor(private val myService: MyService) {
    //不使用RetrofitManager直接依赖注入
//    val myService: MyService by lazy {
//        RetrofitManager.getRetrofit().create(MyService::class.java)
//    }

    fun video(currentPage: Int) = flow {
        emit(myService.video())
    }.flowOn(Dispatchers.IO)
}